class Solution {
public:
    vector<int> divisibilityArray(string word, int m) {
        vector<int>ans;
        long long res = 0;
        for (auto x : word) {
            res = (res * 10 + (x - '0')) % m;
            if (!res)ans.push_back(1);
            else ans.push_back(0);
        }
        return ans;
    }
};